//
// Created by Administrator on 2020/7/13 0013.
//

#include <cstring>
#include "commodity.h"

int commodity::kinds=0;

commodity::~commodity()
{

}

int commodity::getId() const
{
    return ID;
}

int commodity::getStock() const
{
    return stock;
}

float commodity::getBuyValue() const
{
    return buyValue;
}

float commodity::getSellValue() const
{
    return sellValue;
}

const char *commodity::getName() const
{
    return name;
}

void commodity::UpdateStock(int stock)
{
    commodity::stock += stock;
}

commodity::commodity(float buyValue, float sellValue, char name[])
{

    kinds++;
    ID=kinds;
    stock=0;
    this->buyValue=buyValue;
    this->sellValue=sellValue;
    strcpy(this->name,name);


}

commodity::commodity(int ID, char *name, float buyValue, float sellValue, int stock)
{
    {
        kinds++;
        this->ID = ID;
        this->stock = stock;
        this->buyValue = buyValue;
        this->sellValue = sellValue;
        strcpy(this->name, name);
    }
}
